<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="common">
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
        <nav class="navbar navbar-inverse">
            <div class="container-fluid">
                <a class="navbar-brand" href="#">欢迎来到德莱联盟</a>
                <ul class="nav navbar-nav navbar-right">
                    <li><a href="#">欢迎</a></li>
                    <li><a href="#">欢迎</a></li>
                </ul>
            </div>
        </nav>
<div class="container-fluid">
    <div class="row" >
        <div class="col-md-2">
            <!-- 树 -->
            <div id="tree"  style="background-color: #2694e8">
            </div>
        </div>
        <div class="col-md-10">
            <!-- 选项卡 -->
            <div id="myTabs">
                <!-- 新选项卡 -->
                <ul class="nav nav-tabs" id="tablist">
                    <li role="presentation" class="active">
                        <a href="#home" role="tab" data-toggle="tab">欢迎</a>
                    </li>
                </ul>
                <!-- 选项卡下内容 -->
                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane active" id="home">

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


</body>
<script>
    $(function() {
        getTree();
    })
    function getTree(){
        //alert(11)
        $.ajax({
            url:"../tree/getTree?pid=0",
            dataType:"json",
            success:function(data){
                $("#tree").treeview({
                    data:data,
                    selectable:true,
                    onNodeSelected:function(event, node){
                        $.addtabs({iframeHeight: 550});
                        $.addtabs.add({
                            id:node.id,
                            title:node.text,
//	 					    url:node.url
                            content:createPage(node.url),
                            // url:"../show/url="+node.url,
                        })
                    }
                })
            }
        })
    }
    //使用iframe标签引入页面
    function createPage(url){
        return "<iframe style='width:100%;' height='550px' frameborder='0' scrolling='auto' src='../show?url="+ url + "'></iframe>";
    }
</script>
</html>